<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('电话紧急联系调整')"/>
    <link rel="stylesheet" type="text/css" th:href="@{/ajax/libs/qxEasyUI/themes/default/easyui.css}">
</head>
<style>
    .bootstrap-tagsinput > input {
        display: none;
    }
</style>

<body style="background-color: #F4F6FA">
<div id="admui-siteConTabs " class="main-content" style="margin: 0;padding: 0">

    <form id="form-user-add" class="form-horizontal" th:object="${workFormBase}" style="background-color: #F4F6FA">
        <input type="hidden" name="pkId" id="pkId" th:value="${pkId}">
        <input type="hidden" name="crtStepId" id="txtCrtStepId">
        <input type="hidden" name="crtStepName" id="txtCrtStepName">
        <input type="hidden" name="fpDirect" id="opAct">
        <input type="hidden" name="sortCode" id="sortCode" th:value="${sortCode}">
        <div class="col-sm-12" style="display: flex">
            <!--     左       -->
            <div class="col-sm-6 entering-page">
                <!--   来电基本信息     -->
                <div class="col-sm-12 tltieBoder">
                    <div class="blueBorder"></div>
                    <h4 style="margin:0 0 0 10px">来电及通话信息</h4>
                </div>
                <!--事发地址-->
                <div class="col-sm-12 entering-mt">
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label is-required entering-pd">联系电话：</label>
                        <div class="col-sm-8">
                            <input name="fromTelA" th:field="*{fromTelA}" placeholder="请输入"
                                   class="form-control scene theAddress" type="text">
                        </div>
                    </div>
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">内容类别：</label>
                        <div class="col-sm-8">
                            <input id="qxCT" style="width:143px;height:31px;" th:value="*{dcntAname}">
                            <input id="txtDcntAcode" name="dcntAcode" type="hidden" th:value="*{dcntAcode}"/>
                            <input id="txtDCntAName" name="dcntAname" type="hidden" th:value="*{dcntAname}"/>
                        </div>
                    </div>

                </div>
                <!-- 来电类型,内容类别..-->
                <div class="col-sm-12">
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label  entering-pd">来电人：</label>
                        <div class="col-sm-8">
                            <input name="fromName" th:field="*{fromName}" placeholder="请输入"
                                   class="form-control scene " type="text">
                        </div>
                    </div>
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">来电类别：</label>
                        <div class="col-sm-8">
                            <select name="dfmClaNo" id="dfmClaNo"
                                    th:with="telTypes=${@commonServiceImpl.findTelType()}"
                                    onchange="dropChgSendTextOnly(this,'dfmClaName');"
                                    class="form-control formSelect">
                                <option value="">--请选择--</option>
                                <th:block th:each="item : ${telTypes}">
                                    <option th:text="${item['CSText']}" th:value="${item['CSValue']}"
                                            th:selected="${item['CSValue']} == *{dfmClaNo}"></option>
                                </th:block>
                            </select>
                            <input type="hidden" name="dfmClaName" id="dfmClaName" th:value="*{dfmClaName}"/>
                        </div>
                    </div>
                </div>
                <div class="col-sm-12 entering-mt">
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">地区：</label>
                        <div class="col-sm-8">
                            <select name="fmAreaNo" th:field="*{fmAreaNo}" id="fmAreaNo"
                                    onchange="dropChgSendTextOnly(this,'fmAreaName');"
                                    th:with="district=${@commonServiceImpl.findArea()}" class="form-control formSelect"
                                    required>
                                <option value="">--请选择--</option>
                                <option th:each="item : ${district}" th:text="${item['CSText']}"
                                        th:value="${item['CSValue']}"></option>
                            </select>
                            <input type="hidden" id="fmAreaName" name="fmAreaName" th:value="*{fmAreaName}"/>
                        </div>
                    </div>
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">地址：</label>
                        <div class="col-sm-8">
                            <input name="fmAddress" th:field="*{fmAddress}" placeholder="请输入"
                                   class="form-control scene " type="text">
                        </div>
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">流水号：</label>
                        <div class="col-sm-8">
                            <input id="wsCode" name="wsCode" th:field="*{wsCode}" placeholder="请输入"
                                   class="form-control serial"
                                   type="text"
                                   maxlength="11" required="" disabled>
                        </div>
                    </div>
                    <div class="form-group col-sm-6">
                        <label class="col-sm-4 control-label entering-pd">提取码：</label>
                        <div class="col-sm-8">
                            <input name="wsKey" placeholder="请输入"
                                   class="form-control code"
                                   type="text" th:field="*{wsKey}"
                                   maxlength="11" required="" disabled>
                        </div>
                    </div>
                </div>
                <div class="col-sm-12" style="margin: 8px 0 8px 0;">
                    <div class="form-group">
                        <label class="col-xs-2 control-label entering-pd">通话内容：</label>
                        <div class="col-xs-10">
                            <!--呈批-->
                            <textarea name="fmContent" th:field="*{fmContent}" maxlength="3500"
                                      class="form-control workRemark"
                                      rows="3" style="height: 100px"></textarea>
                        </div>
                    </div>
                </div>
            </div>
            <!--     右       -->
            <div class="col-sm-6 entering-page">
                <div class="col-sm-12">
                    <!--   工单基本信息     -->
                    <div class="col-sm-12 tltieBoder">
                        <div class="blueBorder"></div>
                        <h4 style="margin:0 0 0 10px">工单基本信息</h4>
                    </div>
                    <!--工单主题,工单编号,工单性质...-->
                    <div class="col-sm-12">
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">工单主题：</label>
                            <div class="col-sm-8">
                                <input name="wsTopic" th:field="*{wsTopic}" placeholder="请输入"
                                       class="form-control workTheme" type="text"
                                       required="">
                            </div>
                        </div>
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label is-required entering-pd">工单编号：</label>
                            <div class="col-sm-8">
                                <input name="workFormNo" th:field="*{workFormNo}" placeholder="请输入"
                                       class="form-control scene theAddress" type="text" disabled>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label  entering-pd">工单性质：</label>
                            <div class="col-sm-8">
                                <select name="setProId" id="setProId" onchange="getSetProName()"
                                        th:with="district=${@commonServiceImpl.findWorkFormType()}"
                                        class="form-control formSelect">
                                    <option value="">--请选择--</option>
                                    <option th:each="item : ${district}" th:text="${item['CSText']}"
                                            th:value="${item['CSValue']}"
                                            th:selected="${item['CSValue']} == *{setProId}"></option>
                                </select>
                                <input id="setProName" type="hidden" name="setProName" th:value="*{setProName}"/>
                            </div>
                        </div>
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">拟办时限：</label>
                            <div class="col-sm-8">
                                <input name="wfLimit" th:field="*{wfLimit}" placeholder="请输入"
                                       class="form-control code"
                                       type="text">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">建议公开：</label>
                            <div class="col-xs-8">
                                <label class="check-box">
                                    <input name="openX" th:checked="*{openX == 1}" value="1" type="radio">是
                                </label>
                                <label class="check-box">
                                    <input name="openX" th:checked="*{openX == 0}" value="0" type="radio">否
                                </label>
                            </div>
                        </div>
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd spRed">是否紧急：</label>
                            <div class="col-xs-8">
                                <label class="check-box">
                                    <input name="mark" th:checked="*{mark == '1'}" value="1" type="radio">是
                                </label>
                                <label class="check-box">
                                    <input name="mark" th:checked="*{mark == '0'}" value="0" type="radio">否
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">创建人：</label>
                            <div class="col-sm-8">
                                <input name="iptWorker" th:field="*{iptWorker}" placeholder="请输入"
                                       class="form-control code"
                                       type="text" disabled>
                            </div>
                        </div>
                        <div class="form-group col-sm-6">
                            <label class="col-sm-4 control-label entering-pd">创建时间：</label>
                            <div class="col-sm-8">
                                <input name="iptTime" th:field="*{iptTime}" placeholder="请输入"
                                       class="form-control code"
                                       type="text" disabled>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--内下-->
        <div class="col-sm-12 entering-page">
            <!--   拟办部门     -->
            <div class="col-sm-12 tltieBoder">
                <div class="blueBorder"></div>
                <h4 style="margin:0 0 0 10px">派单情况</h4>
            </div>
            <div class="col-sm-12 entering-page">
                <table id="bootstrap-table"></table>
            </div>
            <!--按钮-->
            <div class="col-sm-12 entering-bt" style="justify-content: center;">
                <button type="button" class="btn btn-sm btn-info" id="btnBack" onclick="btnSbmtClick()">提交
                </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <button type="button" class="btn btn-sm btn-warning" onclick="$.modal.closeTab()">关闭
                </button>&nbsp;
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer"/>
<script th:src="@{/ajax/libs/qxEasyUI/jquery.easyui.min.js}"></script>
<script>
    var prefix = ctx + "gaoxin/system/mTelWF";
    var send = ctx + "gaoxin/system/sendBack";
    // 选择内容分类
    $('#qxCT').combotree({
        url: '/system/common/findContentCate',
        required: false,
        onSelect: function (record) {
            $("#txtDcntAcode").val(record.id);
            $("#txtDCntAName").val(record.text);
            var dfmClaName = $("#dfmClaNo option:selected").text();
            var fromName = $("#fromName").val();
            $("#wsTopic").val(fromName + '[' + dfmClaName + ']' + record.text);
        }
    });

    $('#dfmClaNo').change(function () {
        var dfmClaName = $("#dfmClaNo option:selected").text();
        var txtDCntAName = $("#txtDCntAName").val();
        var fromName = $("#fromName").val();
        $("#wsTopic").val(fromName + '[' + dfmClaName + ']' + txtDCntAName);
    })

    function getSetProName() {
        var proName = $("#setProId").find("option:selected").text();
        if (proName === '-请选择-') {
            $("#setProName").val("");
        } else {
            $("#setProName").val(proName);
        }
    }

    function proposed() {
        let pkId = $('#pkId').val();
        let telId = $('#getDealPk').val();
        var url = send + "/proposed/" + pkId+"?wfId="+pkId+"&telId="+telId;
        var width = '70%';
        var config = {
            id: 'deptdialog',
            title: '拟办部门',
            width: width,
            url: url,
            callBack: function(index, layero) {
                var iframeWin = layero.find('iframe')[0];
                iframeWin.contentWindow.submitHandler();
            }
        };
        $.modal.openOptions(config);
    }

    function btnSbmtClick() {
        if ($.validate.form()) {
            let data = $('#form-user-add').serializeArray();
            $.operate.saveTab(prefix + "/rManage/tWBankNameSave", data);
        }
    }

    $(function () {
        var send = ctx + "gaoxin/system/sendBack";
        let wfId = $('#pkId').val();
        //拟派电话工单列表
        var options = {
            url: send + '/simulacrumList/' + wfId,
            sortName: "pkid",
            modalName: "派单",
            detailUrl: prefix+"/forShow/dealDetail/{id}",
            sortOrder: "desc",
            uniqueId: "pkId",
            removeUrl: send + "/remove",
            showColumns: false,                  //是否显示所有的列（选择显示的列）
            showRefresh: false,
            showSearch: false,
            showToggle: false,
            fixedColumns: true,
            fixedNumber: 1,
            fixedRightNumber: 2,
            columns: [{
                field: 'pkId',
                title: 'id',
                visible: false
            },
                {
                    field: 'seqName',
                    title: '交办次序',
                    width: 100,
                    align: 'center',
                }, {
                    field: 'sortName',
                    title: '办理性质',
                    width: 100,
                    align: 'center',
                }, {
                    field: 'dealName',
                    title: '办理方式',
                    width: 100,
                    align: 'center',
                }, {
                    field: 'sbdeptName',
                    title: '承办单位',
                    width: 240,
                    align: 'center',
                }, {
                    field: 'sdeptName',
                    title: '派发单位',
                    width: 240,
                    align: 'center',
                }, {
                    field: 'backLimit',
                    title: '要求期限',
                    width: 160,
                    align: 'center',
                }, {
                    field:'sendTime',
                    title:'派发时间',
                    align:'center',
                    width: 160
                }, {
                    field: 'sendState',
                    title: '办理情况',
                    align: 'center',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return fmtSBSendState(value, row, index);
                    }
                },{
                    field : 'wfId',
                    title: '操作',
                    width: 60,
                    align: 'center',
                    valign: 'middle',
                    formatter: actionFormatter
                }]
        };
        $.table.init(options);
    });

    function actionFormatter(value, row, index) {
        var actions = [];
        actions.push('<a class="btn btn-success btn-outline btn-xs " href="javascript:void(0)" onclick="$.operate.detail(\'' + row.pkId + '\')">详情</a> ');
        return actions.join('');
    }

    function EditViewById(wfId,sbId){
        var url = send + "/editDept/"+wfId+"/"+sbId;
        var width = '70%';
        var config = {
            id: 'deptdialog',
            title: '拟办部门',
            width: width,
            url: url,
            callBack: function(index, layero) {
                var iframeWin = layero.find('iframe')[0];
                iframeWin.contentWindow.submitHandler();
            }
        };
        $.modal.openOptions(config);
        // $.modal.open('修改拟办部门', url);
    }

</script>
</body>
</html>